﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WpfApplication
{
    class Multimeter
    {
        public double ReadVoltage(Load impedance, ACPSController supply)
        {
            double measurement;
            if (supply.ReadMode(impedance) == Mode.ConstantVoltage)
            {
                measurement = (supply.Voltage / impedance.Resistance) * impedance.Resistance;
            }
            else
                measurement = supply.Current * impedance.Resistance;
            return Math.Round(measurement, 2);
        }
        

        public double ReadCurrent(Load impedance, ACPSController supply)
        {
            double measurement;
            if (supply.ReadMode(impedance) == Mode.ConstantCurrent)
                measurement = (supply.Current * impedance.Resistance) / impedance.Resistance;
            else
                measurement = supply.Voltage / impedance.Resistance;
            return Math.Round(measurement, 2);
        }
    }
}

